package org.jeecg.modules.solitaire_app.control.controller;

import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.solitaire_app.annotation.SignatureValidation;
import org.jeecg.modules.solitaire_app.app.entity.VO.HomeResultVO;
import org.jeecg.modules.solitaire_app.app.entity.YsyOilType;
import org.jeecg.modules.solitaire_app.app.entity.YsyRefinery;
import org.jeecg.modules.solitaire_app.app.query.RefineryPriceQuery;
import org.jeecg.modules.solitaire_app.control.entity.YsyRefineryPrice;
import org.jeecg.modules.solitaire_app.control.service.IYsyControlKeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@Api(tags = "第三方对接")
@RestController
@RequestMapping("/app/control")
public class AppController {

    @Autowired
    private IYsyControlKeyService ysyControlKeyService;

    @AutoLog(value = "获取炼厂报价")
    @ApiOperation(value = "获取炼厂报价", notes = "获取炼厂报价")
    @PostMapping("/getRefineryPrice")
    @SignatureValidation
    public Result<PageInfo<HomeResultVO>> getRefineryPrice(@RequestBody RefineryPriceQuery refineryPriceQuery){
        return ysyControlKeyService.getRefineryPrice(refineryPriceQuery);
    }


    @AutoLog(value = "获取油品分类,type=1-汽油，2-柴油，3-油原料")
    @ApiOperation(value = "获取油品分类,type=1-汽油，2-柴油，3-油原料", notes = "获取油品分类,type=1-汽油，2-柴油，3-油原料")
    @GetMapping("/getOilTypeList/{type}")
    @SignatureValidation
    public Result<List<YsyOilType>> getOilTypeList(@PathVariable Integer type){
        return ysyControlKeyService.getOilTypeList(type);
    }

    @AutoLog(value = "获取全部炼厂")
    @ApiOperation(value = "获取全部炼厂", notes = "获取全部炼厂")
    @GetMapping("/getRefineryList")
    @SignatureValidation
    public Result<List<YsyRefinery>> getRefineryList(){
        return ysyControlKeyService.getRefineryList();
    }
}
